<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/page/share/taglib.jsp" %>
<html>
<head>
<title>题库管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/vip.css" type="text/css">
<script language="JavaScript">
<!--
function checkfm(form){
	/*if (trim(form.name.value)==""){
		//alert("组织结构名称不能为空！");
		form.name.focus();
		return false;
	}*/
	form.query.value="true";
	form.page.value="1";
	return true;
}

function actionEvent(methodname){
	var form = document.forms[0];
	if(validateIsSelect(form.all, form.questionids)){
		if(!confirm("是否执行该操作"))return;
		form.action='question_'+methodname+'.html';
		form.submit();
	}else{
		alert("请选择要操作的记录");
	}
}

function allselect(allobj,items){
    var state = allobj.checked;
    if(items.length){
    	for(var i=0;i<items.length;i++){
    		if(!items[i].disabled) items[i].checked=state;
    	}
    }else{
    	if(!items.disabled) items.checked=state;
    }
}
/*
 * 判断是否选择了记录
 */
function validateIsSelect(allobj,items){
    var state = allobj.checked;
    if(items.length){
    	for(var i=0;i<items.length;i++){
    		if(items[i].checked) return true;
    	}
    }else{
    	if(items.checked) return true;
    }
    return false;
}


	//到指定的分页页面
	function topage(page){
		var form = document.forms[0];
		form.page.value=page;
		form.submit();
	}
//-->
</script>
<SCRIPT language="JavaScript" src="/js/FoshanRen.js"></SCRIPT>
</head>

<body bgcolor="#FFFFFF" text="#000000" marginwidth="0" marginheight="0">
<s:form action="question_list.html" method="post"  onsubmit="return checkfm(this)">
<s:hidden name="page"/>
<s:hidden name="query"/>
	<table width="98%" height="35" border="0" align="center"
  	style="margin-top: 6px;margin-bottom: 10px;">
  	<tr style="background-color: #9CDCF9;"><td class="STYLE1">
  		&nbsp;&nbsp;&nbsp;&nbsp;你现在的位置是： &nbsp;题库管理&nbsp; &gt;&gt; &nbsp;题目列表</td>
  	</tr>
  	</table>
<table width="98%" border="0" align="center">
    <tr>
      <td width="5%" bgcolor="#9CDCF9"> <div align="center"><font color="#1E5494">选择</font></div></td>
      <td width="8%" bgcolor="#9CDCF9"> <div align="center"><font color="#1E5494">代号</font></div></td>
      <td width="8%" nowrap="nowrap" bgcolor="#9CDCF9"> <div align="center"><font color="#1E5494">修改</font></div></td>
      <td bgcolor="#9CDCF9"> <div align="center"><font color="#1E5494">试题内容</font></div></td>
      <td width="8%" nowrap="nowrap" bgcolor="#9CDCF9"> <div align="center"><font color="#1E5494">题型</font></div></td>
	  <td width="10%" bgcolor="#9CDCF9"><div align="center"><font color="#1E5494">知识点</font></div></td>
      <td width="8%" bgcolor="#9CDCF9"><div align="center"><font color="#1E5494">难度</font></div></td>
      <td width="8%" bgcolor="#9CDCF9"><div align="center"><font color="#1E5494">已考次数</font></div></td>
      <td width="10%" bgcolor="#9CDCF9"><div align="center"><font color="#1E5494">状态</font></div></td>
    </tr>
<!---------------------------LOOP START------------------------------>
<c:forEach items="${pageView.records}" var="entity">
    <tr>
      <td bgcolor="f5f5f5"> <div align="center">
      	<input type="checkbox" name="questionids" value="${entity.id}"/>
      	</div>
      </td>
      <td bgcolor="f5f5f5"> <div align="center">${entity.id}</div></td>
      <td bgcolor="f5f5f5"> <div align="center"><a href='<s:url action="question_editUI.html"/>?id=${entity.id}'>
	  	<img src="/images/edit.gif" width="15" height="16" border="0"></a></div></td>
      <td bgcolor="f5f5f5"> <div align="left"><a href="question_viewUI.html?id=${entity.id}">
      	<c:if test="${fn:length(entity.title)>25}">${fn:substring(entity.title,0,22)}...</c:if>
      	<c:if test="${fn:length(entity.title)<=25}">${entity.title}</c:if></a></div>
      </td>
      <td bgcolor="f5f5f5"> <div align="center">${entity.type.name}</div></td>
	  <td bgcolor="f5f5f5"> <div align="center">${entity.point.name}</div></td>
	  <td bgcolor="f5f5f5"> <div align="center">${entity.hardEasy.name}</div></td>
	  <td bgcolor="f5f5f5"> <div align="center">${entity.appearCount}</div></td>
      <td bgcolor="f5f5f5"> <div align="center">
	  	<c:if test="${entity.visible}">
      		<font color="red">启用</font>
      	</c:if>
      	<c:if test="${!entity.visible}">禁用</c:if>
	  </div></td>
	</tr>
</c:forEach>
    <!----------------------LOOP END------------------------------->
    <tr> 
      <td bgcolor="f5f5f5" colspan="9" align="center">
      <table width="100%" border="0" cellspacing="1" cellpadding="3">
          <tr>
          	<td width="8%"><INPUT TYPE="checkbox" NAME="all" <c:if test="${fn:length(pageView.records)<1}">disabled="disabled"</c:if>
              onclick="javascript:allselect(this,this.form.questionids)">全选</td> 
            <td width="8%"><div align="right">关键字：</div></td>
            <td width="84%">
              <s:textfield name="question.title" size="30" maxlength="30"/> &nbsp;&nbsp;
              <s:select name="type" list="#{'':'-全部题型-','SingleChoice':'单项选择题','MultiChoice':'多项选择题','FillIn':'填空题','Essay':'论述题','Document':'文档处理题','Program':'编程题','Judgment':'判断题','ShortAnswer':'简答题','Glossary':'名词解释题'}"
              	listKey="key" listValue="value">
              </s:select>&nbsp;&nbsp;
			  <input type="submit" class="frm_btn" value=" 查 询 "> &nbsp;&nbsp;
              <input type="button" class="frm_btn" onClick='javascript:window.location.href="question_addUI.html?type=SingleChoice"' value=" 添 加 "> &nbsp;&nbsp;
               <input type="button" class="frm_btn"
				<c:if test="${fn:length(pageView.records)<1}">disabled="disabled"</c:if>
				onClick="javascript:actionEvent('visible')" value=" 启 用 "> &nbsp;&nbsp;
			  <input type="button" class="frm_btn"
				<c:if test="${fn:length(pageView.records)<1}">disabled="disabled"</c:if>
				onClick="javascript:actionEvent('disvisible')" value=" 禁 用 "> &nbsp;&nbsp;
            </td>
          </tr>
        </table>
        </td>
    </tr>
    <tr >
    	<td colspan="9" align="right">
    	<%@ include file="/WEB-INF/page/share/fenye.jsp" %>
   		</td>
   	</tr>
  </table>
</s:form>
</body>
</html>